
import java.util.Random;

public class test6 {
    public static void main(String[] args) {
        Random rand = new Random();
        int j = 0;
        boolean flag = false;
        int a[] = new int[7];
        while (j < 7) {
            int r = rand.nextInt(33) + 1;
            if (j == 0) {

                a[j] = r;
                j++;
            } else {
                for (int m = 0; m < j; m++) {
                    if (a[m] == r) {
                        flag = true;
                    }
                }
                if (flag == false) {
                    a[j] = r;
                    j++;
                }
                flag = false;
            }

        }
        System.out.println("7个随机数为：");
        for (int n = 0; n < 7; n++) {
            System.out.println(a[n]);
        }

    }
}
